package com.yeban.javase.day07.test04_reg;

import java.util.Arrays;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/15
 *
 * 2.使用正则表达式切割字符串
 * 192.168.105.27 按照  . 号切割字符串
 * 18 22 40 65 按照空格切割字符串
 */
public class Test02 {

    public static void main(String[] args) {

        String str1 = "192.168.105.27";
        String str2 = "18  22 40 65";

        String regex1 = "\\.";
        String regex2 = "[ ]+";

//        String[] strs1 = new String[15];
//        String[] strs2 = new String[15];
        String[] strs1 = str1.split(regex1);
        String[] strs2 = str2.split(regex2);

        System.out.println(Arrays.toString(strs1));
        System.out.println(Arrays.toString(strs2));

    }
}
